<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<div id="sidebar" class="sidebar responsive ace-save-state">
	<script type="text/javascript">
		try {
			ace.settings.loadState('sidebar')
		} catch (e) {
		}
	</script>



	<ul class="nav nav-list">
		<li class=""><a href="index.html"> <i class="menu-icon fa fa-tachometer"></i> <span class="menu-text"> 系统首页 </span>
		</a> <b class="arrow"></b>
		</li>

		<!--
                         open:表示菜单打开
						 active：表示菜单选中
		-->
		<c:forEach var="modular" items="${sessionScope.admin.modulars }">
			<li class="open "><a href="#" class="dropdown-toggle"> <i class="menu-icon fa fa-desktop"></i> <span class="menu-text"> ${modular.MODULAR_NAME } </span> <b
					class="arrow fa fa-angle-down"></b>
			</a> <b class="arrow"></b>
	
				<ul class="submenu">
				    <c:forEach  var="permisssion" items="${sessionScope.admin.role.permisssions }">
				       <%--
				         	判断只输出菜单类型的，可见的菜单权限
				        --%>
				       <c:if test="${permisssion.PERMISSION_TYPE=='menu' and permisssion.PERMISSION_IS_SHOW==0 and permisssion.MODULAR_ID==modular.MODULAR_ID}">
				          <c:choose>
				            <c:when test="${fn:contains(sessionScope.path,permisssion.PERMISSION_ACTION) }">
				              	  <li class="active">
								  	<a href="${pageContext.request.contextPath}${permisssion.PERMISSION_ACTION}/0"> <i class="menu-icon fa fa-caret-right"></i> ${permisssion.PERMISSION_NAME }
								  </a> <b class="arrow"></b>
							</li>
				            </c:when>
				            <c:otherwise>
				            	<li class="">
								  <a href="${pageContext.request.contextPath}${permisssion.PERMISSION_ACTION}/0"> <i class="menu-icon fa fa-caret-right"></i> ${permisssion.PERMISSION_NAME }
								  </a> <b class="arrow"></b>
								</li>
				            </c:otherwise>
				          </c:choose>
				
						</c:if>
					</c:forEach>
					
				</ul>
				
			</li>
		</c:forEach>





	</ul>
	<!-- /.nav-list -->

	<div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
		<i id="sidebar-toggle-icon" class="ace-icon fa fa-angle-double-left ace-save-state" data-icon1="ace-icon fa fa-angle-double-left"
			data-icon2="ace-icon fa fa-angle-double-right"></i>
	</div>
</div>